package com.huangpeng.designmodel.nullObjectModel;

/**
 * @Author hp
 * @Title 工厂类
 * @Package
 * @Date 2022/1/18 14:30
 * @Description
 * @Version 1.0
 */
public class CustomerFactory {
    public static final String[] names = {"Rob", "Joe", "Julie"};
    static  int length = names.length;
    public static AbstractCustomer getCustomer(String name){
        for (int i = 0; i < length; i++) {
            if(names[i].equalsIgnoreCase(name)){
                return new RealCustomer(name);
            }
        }
        return new NullCustomer();
    }
}
